package com.project.service;

import com.project.bean.UserBean;
import com.project.dao.IUserDao;
import com.project.server.Request;
import com.project.server.Response;
import com.project.uitl.DaoFactory;
import com.project.uitl.WebServlet;

@WebServlet("land")
public class LoginService  implements Servlet {

    private IUserDao dao =(IUserDao) DaoFactory.getDao("IUserDao");
    /**
     * 业务处理，处理登陆
     *
     * @param request  请求对象
     * @param response 响应对象
     */
    public void service(Request request, Response response) {
//得到from表单数据
        String name = request.getParameter("userName");
        String pwd = request.getParameter("pwd");

       UserBean user= dao.Login(name,pwd);
        if (user!=null) {
            response.sendMessage("登陆成功");
        } else {
            response.sendMessage("登陆失败");
        }

    }

}
